<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Models\News\News;
use App\Models\News\NewsClass;
use App\Models\News\NewsContent;
class Test extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'test:name';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {

        $list = \DB::table('Expert')->get();
        $class = [
            0 => 52,
            1 => 53,
        ];
        foreach ($list as $key => $value) {
            # code...
            // $temp = [
            //     // 'new_id' => $value->Id,
            //     'title' => $value->Name,
            //     'titlepic' => $value->Cover,
            //     'listorder' => $value->Sort,
            //     'onclick' => $value->gSort,
            //     'class_id' => $class[$value->type],
            //     'created_at' => date('Y-m-d H:i:s'),
            //     'attr' => json_encode([
            //         'sex' => $value->Sex,
            //         'gzdw' => $value->GzDw,
            //         'zhiwu' => $value->ZhiWu,
            //         'zhunye' => $value->ZhunYe,
            //         'zhunti' => $value->ZhunTi,
            //         'lingyu' => $value->LingYu,
            //         'chengguo' => $value->ChengGuo,
            //         'cailiao' => $value->CaiLiao,
            //         'video' => $value->Video,
            //         'chengguo' => $value->ChengGuo,
            //         'lytype' => $value->LyType,
                    
            //     ])
            // ];
            $info = News::where('title', $value->Name)->first();
            if(!$info)continue;
            $temp = [
                'content'=> $value->Des,
                'new_id' => $info->id
            ];
            // News::insert($temp);
            NewsContent::insert($temp);
            // $data[] = $temp;
        }
        // dd($data);
        // News::insert($data);
        dd(1);
    }
	
	
}
